package com.cyj.dream.core.exception;

import com.cyj.dream.core.constant.enums.ResultCode;
import lombok.Data;

/**
 * @Description: 自定义异常实体类--强制同步
 * @BelongsProject: DreamChardonnay
 * @BelongsPackage: com.cyj.dream.core.exception
 * @Author: ChenYongJia
 * @CreateTime: 2021-09-26 10:58
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Data
public class BusinessException extends RuntimeException {

	protected Integer code;

	protected String message;

	public BusinessException(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
	public BusinessException(String message) {
		this.code = 1;
		this.message = message;
	}
	public BusinessException(ResultCode resultCode) {
		this.code = resultCode.code();
		this.message = resultCode.message();
	}
}
